home *** CD-ROM | disk | FTP | other *** search
- #include "ToolSort.h"
-
- /*=========================================================================
- Module: SelToText
-
- Purpose: Transform the structure SelLine to SelTxt (text).
-
- Returns: txt, err
-
- =========================================================================*/
-
- SelToText( sortSel, txt )
- SelLine sortSel; /* array of handles to sorted lines of text */
- Text *txt; /* handle to lines in text format */
- {
- int err = 0;
- long num; /* number of lines */
- int l; /* line number index */
-
- *txt = 0L;
- num = sortSel.noLines;
-
- if ( num > 0 )
- {
- *txt = NewHandle(0L);
-
- if (*txt != 0L)
- {
- for ( l=0; l<num && err == noErr; l++ )
- {
- HLock( sortSel.lines[l] ); /* HandAndHand dereference */
- err = HandAndHand( sortSel.lines[l],*txt);
- HUnlock( sortSel.lines[l] );
- }
- if ( err != noErr )
- {
- DisposHandle( *txt );
- *txt = NIL; /* mark handle empty */
- err = Memory_Error;
- }
- }
- else
- err = Nil_Hand_Error;
-
- }
- else
- err = Empty_Error;
-
- return ( err );
- }
-